//
//  main.m
//  hf4-5
//
//  Created by mac on 16-4-5.
//  Copyright (c) 2016年 hf. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Atom.h"
#import "Animal.h"
#import "Person.h"
#import "Mouse.h"
int main(int argc, const char * argv[])
{

    @autoreleasepool {
         
        // insert code here...
        NSLog(@"Hello, World!");
        Person *p=[[Person alloc]init];
        p.name=@"黄锋大人";
        Animal *ani=[[Animal alloc]init];
        ani.name=@"古拉利图";
        
               
        Mouse *m=[[Mouse alloc]init];
        m.name=@"米老鼠";
        
                
        NSString* str=@"hello dengh huangfeng genfj";
        NSArray *yu=[str componentsSeparatedByString:@" "];
        for (int i=0; i<yu.count; i++) {
            /*NSString *n=yu[i];
            NSLog(@"%d,%@",i+1,n);*/  //间接输出。
            
            NSLog(@"%d、%@",i+1,yu[i]);  //直接输出。
        }
        
        
        NSString* tes=@"a,d,c,b";
        NSArray* ty=[tes componentsSeparatedByString:@","];
        ty=[ty sortedArrayUsingSelector:@selector(compare:)];
        for (int j=0; j<ty.count; j++) {
            NSLog(@"%d、%@",j+1,ty[j]);
        }
        
        
        NSArray *numbers=@[@(1),@(4),@(3),@(2)];
        numbers=[numbers sortedArrayUsingSelector:@selector(compare:)];
        for (int j=0; j<numbers.count; j++) {
            NSNumber *s=numbers[j];
            NSLog(@"%d、%@",j+1,s);
        }

    } 
    return 0;
}

